﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WinForm2
{
    public partial class Register : Form
    {
        public Register()
        {
            InitializeComponent();
        }

        //关闭注册窗口
        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //注册
        private void button1_Click(object sender, EventArgs e)
        {
            var uid = userNameTxt.Text;
            var pwd = userPassWprd.Text;
            var pwd2=userPassWord2.Text;

            var userName = !string.IsNullOrEmpty(uid);
            var userPwd = !string.IsNullOrEmpty(pwd);
            var userPwd2 = pwd == pwd2;

            if (userName && userPwd && userPwd2)
            {
                MessageBox.Show("注册成功");
                Form1.users.Add(uid, pwd);
                Form1 form1 = new Form1();
                this.Close();
            }
            else
            {
                MessageBox.Show("注册失败");
            }
           

        }
    }
}
